<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <!-- 请使用 <span> 来组合行内元素，以便通过样式来格式化它们。 -->
        <span>
            <a href="/getCartInfo">购物车</a>
        </span>
    </div>
    <table>
        <tr>
            <td>名称</td>
            <td>单价</td>
            <td>作者</td>
            <td>销量</td>
            <td>库存</td>
            <td>操作</td>
        </tr>
        {{range .}}
        <tr>
            <td>{{.Title}}</td>
            <td>{{.Price}}</td>
            <td>{{.Author}}</td>
            <td>{{.Sales}}</td>
            <td>{{.Stock}}</td>
            <td><a href="/addItem2Cart?itemID={{.ID}}">添加购物车</a></td>
        </tr>
        {{end}}
    </table>
</body>

</html>